home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / GETDFREE.C < prev    next >
Text File  |  1991-08-05  |  530b  |  21 lines

  1. /* getdfree.c --- p. 605 */
  2. #include <stdio.h>
  3. #include <dos.h>
  4. main()
  5. {
  6.     unsigned long total_space, free_space,
  7.             bytes_per_cluster;
  8.     struct dfree dfinfo;
  9.     getdfree(0, &dfinfo);
  10.     if(dfinfo.df_sclus == -1)
  11.     {
  12.         printf("Error in getdfree\n");
  13.         exit(0);
  14.     }
  15.     bytes_per_cluster = dfinfo.df_sclus * dfinfo.df_bsec;
  16.     total_space = dfinfo.df_total * bytes_per_cluster;
  17.     free_space = dfinfo.df_avail * bytes_per_cluster;
  18.     printf("%ld bytes free out of %ld bytes of total "
  19.         "space.\n", free_space, total_space);
  20. }
  21.